package com.nbicc.authentication.service.Impl;

import com.nbicc.authentication.service.IAuthenticationService;
import com.nbicc.authentication.vo.User;
import com.nbicc.common.utils.AuthcUserUtil;
import org.springframework.stereotype.Service;

/**
 * @Author: lilingyan
 */
@Service("AuthenticationServiceImpl")
public class AuthenticationServiceImpl implements IAuthenticationService{

    @Override
    public void authentication(User user) throws Exception {
        if(user.getLoginName().equals("admin") && user.getPassword().equals("admin")){
            AuthcUserUtil.setAuthcUser(user);
            return ;
        }
        throw new Exception("账号密码错误" , new Throwable("账号密码错误"));
    }

    @Override
    public void logout() {
        AuthcUserUtil.logout();
    }

}
